import java.util.*;

/**
 * @author WangChao
 * @version 1.0
 * @date 2023/3/12 10:44
 */
public class Main {
    public static void main(String[] args) {
        int []nums = {4,3,1,2,4};
        beautifulSubarrays(nums);
    }
    public static long beautifulSubarrays(int[] nums) {
        long res = 0;
        int n = nums.length;
        int []pre = new int[n+1];
        for(int i=0;i<n;i++){
            pre[i+1] = pre[i] ^ nums[i];
        }
        HashMap<Integer,Integer> map = new HashMap<>();
        for(int i=0;i<=n;i++){
            res += map.getOrDefault(pre[i],0);
            map.put(pre[i],map.getOrDefault(pre[i],0)+1);
        }
        return res;
    }
}
